package com.snail.readyvr.ui;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;

import com.snail.readyvr.R;

/**
 * Created by MRKING on 2016/9/26.
 */

public class ProgressButton extends FrameLayout {

    private TextView mBtnText;
    private ProgressWheel mProgress;
    private Context mContext;
    public ProgressButton(Context context) {
        this(context,null);
    }

    public ProgressButton(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public ProgressButton(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        mContext = context;
        init();
    }

    private void init() {
        View view = LayoutInflater.from(mContext).inflate(R.layout.login_btn_layout, null);
        mBtnText = (TextView) view.findViewById(R.id.login_btn_text);
        mProgress = (ProgressWheel) view.findViewById(R.id.login_btn_progress);
        addView(view);
    }

    public void setText(String text){
        mBtnText.setText(text);
    }
    public void setText(int resid){
        mBtnText.setText(resid);
    }

    public void setShowProgress(boolean show){
        mProgress.setVisibility(show?View.VISIBLE:View.GONE);
    }
}
